﻿/**
 * @angleTimeArray 时间
 * @gradient 切线角
 */
var angleTimeArray = [];
var gradient = [];

// 初始化专业监测信息查询表格
function inittblZyjc() {
	$("#tblAngle").datagrid({
		url : "",
		striped : true,
		pageSize : 10,
		height : 315,
		nowrap : false,
		columns : [ [ {
			field : 'id',
			title : '内侧点',
			width : 100,
			align : 'center',
			editor : 'text',

		}, {
			field : 'time',
			title : '时间',
			width : 100,
			align : 'center',
			editor : 'text',

		}, {
			field : 'angle',
			title : '切线角',
			width : 120,
			align : 'center',
			editor : 'text',

		}, ] ],
		pagination : true,
		rownumbers : true,
		singleSelect : true,
	});
}

// 专业监测信息查询功能
function queryQiexianjiao(flag) {

	var id = $("#id option:selected").val();
	var param = {
		"id" : id,
		"flag" : flag
	};
	var url = "./servlet/GradientServlet ";
	angleTimeArray = [];
	gradient = [];
	// 查询信息显示框
	$("#tblAngle").datagrid({
		url : url,
		queryParams : param,
		onLoadError : function(res) {
			alert("查询失败!");
		},
		onLoadSuccess : function(res) {
			$.sjw.ajax({
				className : "servlet.GradientServlet",
				method : "getLarger45Count",
				param : {
					
				},
				success : function(result) {
					alert("大于45度的数量：  "+result.larger45Count);
				}
			});
//			alert("查询成功!");
		}
	});
}

function AJAXRequest(url, isAjax, method, data, callback, charSet) {
	var xmlHttp, result;
	if (window.XMLHttpRequest)
		xmlHttp = new XMLHttpRequest();
	else if (window.ActiveXObject)
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200) {

				if (xmlHttp.responseXML != null
						&& xmlHttp.responseXML.xml != null
						&& xmlHttp.responseXML.xml != '')
					result = xmlHttp.responseXML;
				else
					result = xmlHttp.responseText;
				if (isAjax && typeof (callback) == 'function')
					callback(result);

			}
			xmlHttp = null;
		}
	}
	if (url.indexOf("?") > 0)
		url += "&random =" + Math.random();
	else
		url += "?&random =" + Math.random();
	xmlHttp.open(method, url, isAjax);
	xmlHttp.setRequestHeader("Content-Type",
			"application/x-www-form-urlencoded");
	var charset = charSet ? charSet : "gb2312";
	xmlHttp.setRequestHeader("CharSet", charset);
	xmlHttp.send(data);
	try {
		if (!isAjax) {
			var res = result || xmlHttp.responseText || xmlHttp.responseXML;
			if (typeof (callback) == 'function')
				callback(res);
			return res;
		}
	} catch (e) {
	}
	;
}
